<template>
    <div class="tencentCall-box">
        <div class="bg-box">

        </div>
        <div class="outlayer">
            <div class="tencentCall">
                <!-- 1v1通话 -->
                <div class="onebyone">
                    <img src="@/assets/images/fw_icon.png" mode="aspectFill" class="avatar"/>
                    <div class="title">
                        曹建国
                    </div>
                    <div class="tips">
                        您已发起语音通话，等待对方接听...
                    </div>
                </div>
                <!-- 多人语音通话 -->
                <div class="multpeople flexbox justify-content-center align-items-center flex-wrap">
                    <div class="multpeopleitems">
                        <div class="notanswer">
                            待接听
                        </div>
                        <img src="@/assets/images/fw_icon.png" mode="aspectFill" class="avatar"/>
                        <div class="title">
                            曹建国
                        </div>
                    </div>
                    <div class="multpeopleitems">
                        <img src="@/assets/images/fw_icon.png" mode="aspectFill" class="avatar"/>
                        <div class="title">
                            曹建国
                        </div>
                    </div>
                    <div class="multpeopleitems">
                        <img src="@/assets/images/fw_icon.png" mode="aspectFill" class="avatar"/>
                        <div class="title">
                            曹建国
                        </div>
                    </div>
                </div>
                <div class="button-box">
                    <div class="item" @click="microphone = !microphone">
                        <img src="@/assets/call/1mkf_icon.svg" mode="aspectFit" v-if="microphone"/>
                        <img src="@/assets/call/2mkf_icon.svg" mode="aspectFit" v-else/>
                        <div class="label">
                            麦克风<span v-if="microphone">已开启</span>
                            <span v-else>已关闭</span>
                        </div>
                    </div>
                    <div class="item">
                        <img src="@/assets/call/gd_icon.png" mode="aspectFit"/>
                        <div class="tips">
                            10:09
                        </div>
                    </div>
                    <div class="item">
                        <img src="@/assets/call/jt_icon.png" mode="aspectFit"/>
                    </div>
                    <div class="item" @click="loudspeaker = !loudspeaker">
                        <img src="@/assets/call/1ky_icon.svg" mode="aspectFit" v-if="loudspeaker"/>
                        <img src="@/assets/call/2ky_icon.svg" mode="aspectFit" v-else/>
                        <div class="label">
                            扩音<span v-if="loudspeaker">已开启</span>
                            <span v-else>已关闭</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
  
  
<script>
import { mapGetters, mapState } from "vuex";


export default {
    components: {},
    data() {
        return {
            // 默认头像src\assets\imgs\defaultAvatar.jpg
            DeAvatar: require("@/assets/images/defaultAvatar.jpg"),

            tuiCallEngine: '',
            callMessage: "123123123",
            callShow: false,
            acceptBtn: true,
            rejectBtn: true,
            endBtn: true,
            //麦克风
            microphone: true,
            //扬声器
            loudspeaker: true,
        };
    },
    async mounted() {
        console.log(this.$route.path, '当前路由当前路由当前路由当前路由');

        // console.log(restult,'77777777777777777777');
        // TUICallKitServer.init({ SDKAppID, userID, userSig }); 

        this.getSelectCircleByUserId() // 获取所有问圈

        //模拟获取sig
        let restult = GenerateTestUserSig.genTestUserSig(this.userInfo.userId);
        // let restult = await getTrtcUserSigApi({userid: this.userInfo.userId})
        console.log(restult);
        let appids = Number(1400757230);
        const options = {
            SDKAppID: appids, // 接入时需要将 0 替换为您的云通信应用的 SDKAppID
            tim: null // tim 参数适用于业务中已存在 TIM 实例，为保证 TIM 实例唯一性
        }
        this.tuiCallEngine = TUICallEngine.createInstance(options)
        //登录
        this.goTrtcLogin(restult);
        //监听事件
        this.initListener()

    },
    async created() {

    },
    methods: {

    },

    computed: {
        ...mapState(["settings"]),
        ...mapGetters(["sidebarRouters", "sidebar", "token", "userInfo"]),

    },
    watch: {
    },
};
</script>
<style lang="scss" scoped>
.onebyone,
.multpeople {
    display: none;
}

.bg-box {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.outlayer {
    width: 100%;
    z-index: 999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    position: fixed;
    top: 0;
    bottom: 0;
    margin: auto;
}

.tencentCall {
    background: #EDEDED;
    border-radius: 18px;
    z-index: 2;
    position: relative;
    width: 98%;
    padding: 40px;
    box-sizing: border-box;
    span-align: center;
}

.avatar {
    width: 120px;
    height: 120px;
    border-radius: 100%;
}

.title {
    padding-top: 23px;
    font-size: #333;
    font-size: 28px;
}

.tips {
    color: #F67725;
    font-size: 22px;
    padding-top: 17px;
}

.button-box {
    display: flex;
    justify-content: space-around;
    padding-top: 43px;
    max-width: 560px;
    margin: 0 auto;
}

.button-box .item img {
    width: 80px;
    height: 80px;
}

.button-box .item .label {
    color: #BBBBBB;
    font-size: 18px;
    padding-top: 15px;
}


.multpeople {
    // margin-top: 12px;
    min-height: 192px;

    .multpeopleitems {
        position: relative;
        min-width: 20%;
        padding-bottom: 20px;
        box-sizing: content-box;

        .title {
            font-size: 22px;
            color: #666666;
            padding-top: 6px;
        }

        .avatar {
            width: 80px;
            height: 80px;
        }

        .notanswer {
            position: absolute;
            width: 80px;
            height: 80px;
            top: 0;
            left: 0;
            right: 0;
            margin: auto;
            background: #000000;
            opacity: 0.3;
            border-radius: 100%;
            font-size: 16px;
            color: #FFFFFF;
            span-align: center;
            z-index: 2;
            line-height: 40px;
        }
    }
}

.multpeople_video {
    .multpeopleitems_video {
        position: relative;
        border-radius: 10px;
        width: 120px;
        height: 120px;
        margin: 16px;

        .avatar {
            width: 100%;
            height: 100%;
            border-radius: 10px;
        }

        .headimg {
            width: 30px;
            height: 30px;
            border-radius: 100%;
            position: absolute;
            top: 2px;
            left: 2px;
            z-index: 9;
        }
    }

    .notanswer {
        position: absolute;
        width: 100%;
        height: 100%;
        border-radius: 10px;
        // top: 0;
        // left: 0;
        // right: 0;
        // margin: auto;
        background: #000000;
        opacity: 0.3;
        font-size: 16px;
        color: #FFFFFF;
        span-align: center;
        z-index: 2;
        line-height: 120px;
    }

    .multpeopleitems_video.two {
        width: 210px;
        height: 210px;
    }

    .multpeopleitems_video.two .notanswer {
        line-height: 210px;
    }

}

.addpeople {
    width: 200px;
    height: 60px;
    border: 1px solid #FFFFFF;
    border-radius: 30px;
    color: #FFFFFF;
    font-size: 28px;
    font-weight: 600;
    line-height: 60px;
    background: transparent;
    span-align: center;
    margin-top: 40px;
}
</style>